package com.xwd.service;

import com.xwd.dao.BooksMapper;
import com.xwd.domain.dto.BookDto;

import java.util.List;

public class BookServiceImpl implements BookService {
    //service调用Dao层
    private BooksMapper booksMapper;
    public void setBooksMapper(BooksMapper booksMapper) {
        this.booksMapper = booksMapper;
    }

    @Override
    public int addBook(BookDto bookDto) {
        return booksMapper.addBook(bookDto);
    }

    @Override
    public int deleteBookByID(int id) {
        return booksMapper.deleteBookByID(id);
    }

    @Override
    public int updateBook(BookDto bookDto) {
        return booksMapper.updateBook(bookDto);
    }

    @Override
    public BookDto queryBookByID(int id) {
        return booksMapper.queryBookByID(id);
    }

    @Override
    public  List<BookDto> queryBooktByWhere(BookDto bookDto) {
        return booksMapper.queryBooktByWhere(bookDto);
    }

    @Override
    public List<BookDto> queryAllBook() {
        System.out.println("queryAllBook----查询:");
        System.out.println(booksMapper);
        return booksMapper.queryAllBook();
    }

    @Override
    public int updateBookByID(BookDto bookDto) {
        return booksMapper.updateBook(bookDto);
    }
}
